package com.yan.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;



@Controller
public class SessionController {

	 @GetMapping("/index")
     public ResponseEntity index(HttpSession httpSession) {
         httpSession.setAttribute("user", "helloword");
         return ResponseEntity.ok("ok");
     }

     @GetMapping("/helloword")
     public ResponseEntity hello(HttpSession httpSession) {
    	
         return ResponseEntity.ok(httpSession.getAttribute("user")+httpSession.getId());
         
         
     }

}
